import static org.junit.Assert.*;
import play.test.*;
import models.Event;
import models.EventType;
import models.Task;
import models.TaskUserUser;
import models.User;
import play.test.UnitTest;
import org.junit.*;

public class C4Story6 extends UnitTest{
	@Test
	public void editAssignee(){
		User Salma=new User("salma", "mohammed", "hamed", "salma", "123", "salma7amed@gmail.com",
    			"0101420501","84 bla","Cairo","Egypt","").save();
		User Salem = new User("Salem", "sayed", "Abdel Gawad",
				"salemsayed", "123", "salemsayed@gmail.com", "0101420501",
				"84 bla", "Cairo", "Egypt", "").save();
		Task task = new Task("Task 1", "High", null, null, null, Salma).save();
		
		EventType et2 = new EventType("Sprint").save();
		Event defEvent = new Event("default", et2);
		defEvent.tasks.add(task);
		defEvent.save();
		String newValue = "salemsayed";
		User assignee = User.find("userName", newValue).first();
		TaskUserUser tuu = new TaskUserUser(Salma,task);
		tuu.assignee=assignee ;
		String x =(String)tuu.assignee.userName;
		String y =(String)Salem.userName;
		
		assertEquals(x,y);
		
	}

}
